//
//  MFALogger.h
//  NewMissFresh
//
//  Created by 董宝君 on 2019/6/12.
//  Copyright © 2019 com.missfresh. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#ifndef __MFAnalytics__MFALogger__
#define __MFAnalytics__MFALogger__

#define MFALogLevel(lvl,fmt,...)\
[MFALogger log : YES                                      \
level : lvl                                                  \
file : __FILE__                                            \
function : __PRETTY_FUNCTION__                       \
line : __LINE__                                           \
format : (fmt), ## __VA_ARGS__]

#define MFALog(fmt,...)\
MFALogLevel(MFALoggerLevelInfo,(fmt), ## __VA_ARGS__)

#define MFAError MFALog
#define MFADebug MFALog

#endif/* defined(__MFAnalytics__MFALogger__) */

NS_ASSUME_NONNULL_BEGIN

/**
 日志级别

 - MFALoggerLevelInfo: 显示信息级别的日志
 - MFALoggerLevelWarning: 警告级别的日志
 - MFALoggerLevelError: 错误级别的日志
 */
typedef NS_ENUM(NSUInteger, MFALoggerLevel) {
    MFALoggerLevelInfo = 1,
    MFALoggerLevelWarning,
    MFALoggerLevelError,
};

/**
 SDK内部的日志处理模块
 */
@interface MFALogger : NSObject
@property (class , readonly, strong) MFALogger *sharedLogger;
+ (BOOL)isLoggerEnabled;
+ (void)enableLog:(BOOL)enableLog;
+ (void)log:(BOOL)asynchronous
      level:(NSInteger)level
       file:(const char *)file
   function:(const char *)function
       line:(NSUInteger)line
     format:(NSString *)format, ... ;
@end

NS_ASSUME_NONNULL_END
